package com.moge.anjian.activities;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
import android.widget.RadioGroup;

import androidx.activity.ComponentActivity;
import androidx.annotation.Nullable;

import com.moge.anjian.R;

public class AnjianRuleActivity extends ComponentActivity {

    Button btnOk;
    RadioGroup rbPlan, rbTimes;

    boolean isNow = true;

    @SuppressLint("MissingInflatedId")
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_anjian_rule);

        btnOk = findViewById(R.id.btn_save);
        rbPlan = findViewById(R.id.rg);
        rbTimes = findViewById(R.id.rg_times_second);

        rbPlan.setOnCheckedChangeListener((group, checkedId) -> {
            if (checkedId == R.id.rb_now) {
                Log.e("dimoge", "立即执行");
                isNow = true;
            } else if (checkedId == R.id.rb_schdule) {
                Log.e("dimoge", "计划执行");
                isNow = false;
            }
        });
        rbTimes.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                if (checkedId == R.id.rb_times_1) {
                    Log.e("dimoge", "每秒一次");
                }else if (checkedId == R.id.rb_times_10) {
                    Log.e("dimoge", "每秒十次");
                }else if (checkedId == R.id.rb_times_30) {
                    Log.e("dimoge", "每秒30次");
                }
            }
        });

    }
}
